let spacesXAxis = ['01月', '02月', '03月', '04月', '05月', '06月', '07月', '08月', '09月', '10月', '11月', '12月'];
let spacesData = [];
spacesXAxis.forEach(a=>{
	spacesData.push(parseInt(Math.random()*100000 + 1));
})
let spacesData2 = [];
spacesXAxis.forEach(a=>{
	spacesData2.push(parseInt(Math.random()*100000 + 1));
})


const ndsdfyOpt = {
	legend: {
	  data: ['用水', '用电'],
		right: "20",
		top: "18",
		icon: "rect",
		itemHeight: 10,
		itemWidth: 10
	},
  tooltip: {
    trigger: 'axis',
    axisPointer: {
      type: 'shadow',
      shadowStyle: {
        color: 'rgba(0,145,255,0.00)',
      }
    },
    borderWidth: 0,
    textStyle: {
      fontWeight: 'normal',
      fontSize: 13
    },
    padding: [10, 15],
    formatter: function (param) {
      return param[0].name + "<br>" + param[0].value;
    }
  },
  grid: {
    left: '3%',
    right: '4%',
    bottom: '3%',
    containLabel: true
  },
  xAxis: {
    type: 'category',
    axisTick: {show: false},
    axisLine: {
      lineStyle: {
        color: '#c1e4ff'
      }
    },
    axisLabel: {
      interval:0,
      color: '#000',
	  fontSize:10
    },
    data: spacesXAxis
  },
  yAxis: {
    type: 'value',
    splitLine: {
      lineStyle: {
        color: '#c1e4ff'
      }
    },
    axisTick: {show: false},
    axisLabel: {
      color: '#000'
    },
    nameTextStyle: {
      padding: [20,50, 0, 20],
    }
  },
  series: [
    {
      name: '',
      type: 'pictorialBar',
      symbolSize: [12, 6],
      symbolOffset: [-7, -3], // 上部椭圆 位置
      symbolPosition: 'end',
      z: 12,
      label: {
        normal: {
          show: false,
          position: 'top',
          fontSize: 13,
          color: 'trans',
        },
      },
      color: '#72d1d2',
      data: spacesData,
    },
    // 中间的长方形柱状图(柱状图):bar
    {
      type: 'bar', // 柱状图
	  name:'用水',
      barWidth: 12, // 柱条的宽度,不设时自适应
      itemStyle: {
        color: {
          "x": 0,
          "y": 0,
          "x2": 0,
          "y2": 1,
          "type": "linear",
          "global": false,
          "colorStops": [{
            "offset": 0, // 0%处的颜色
            "color": "#34bac6"
          }, {
            "offset": 1, // 100%处的颜色
            "color": "#72d1d2"
          }]
        }
      },
      data: spacesData,
    },
	{
	  name: '',
	  type: 'pictorialBar',
	  symbolSize: [12, 6],
	  symbolOffset: [7, -3], // 上部椭圆 位置
	  symbolPosition: 'end',
	  z: 12,
	  label: {
	    normal: {
	      show: false,
	      position: 'top',
	      fontSize: 13,
	      color: '#FFFFFF',
	    },
	  },
	  color: '#0091FF',
	  data: spacesData2,
	},
	// 中间的长方形柱状图(柱状图):bar
	{
	  type: 'bar', // 柱状图
	  name:'用电',
	  barWidth: 12, // 柱条的宽度,不设时自适应
	  itemStyle: {
	    color: {
	      "x": 0,
	      "y": 0,
	      "x2": 0,
	      "y2": 1,
	      "type": "linear",
	      "global": false,
	      "colorStops": [{
	        "offset": 0, // 0%处的颜色
	        "color": "#0091FF"
	      }, {
	        "offset": 1, // 100%处的颜色
	        "color": "#72d1d2"
	      }]
	    }
	  },
	  data: spacesData2,
	},
  ]
}

const ndsdfyChart = echarts.init(document.getElementById('ndsdfy'));
ndsdfyChart.setOption(ndsdfyOpt)